<!DOCTYPE html>
<html>
<#include "../head.html">
    <body>
    <div class="mc">
        <div class="mc-l">
            <!--左侧导航---{-->
            <div id="navPanelContainer">
                <div class="system-logo cd"></div>
                <!--管理员信息---{-->
                <#include "../adminInfo.html">
                    <!--管理员信息---}-->
                    <div class="nav-wrap">
                        <#include "leftFromYyToCf.html">
                    </div>
            </div>
            <!--左侧导航---}-->
        </div>
        <div class="mc-m">
            <div class="navToggle"></div>
        </div>
        <div class="mc-r">
            <!--顶部导航---{-->
            <#include "../topNav.html">
                <!--顶部导航---}-->
                <#assign fd="FINANCE_DIRECTOR">
                    <!--面包屑导航---{-->
                    <#assign moduleName="客户申购记录">
                        <#include "banner.html">
                            <!--面包屑导航---}-->

                            <!--工具栏--{-->
                            <div id="toolbar" class="clearfix">
                                <div class="toolbor-module export">
                                    <#if buySum??><div style="height:22px;line-height:22px;float:left;color:red;margin-left:12px;"> 申购总额：${buySum}元   | 待收总额：${total}元   | 利息总额：${interestSum}元 </div></#if>
                                </div>
                                <div class="toolbor-module search">




                                    <#if fd  == auth_user.userType.code>
                                        <div style="width:100px;text-align:right;height:22px;line-height:22px;float:left;margin-left: 10px;">
                                            理财经理：

                                        </div>
                                        <select id="fmId" name="fmId" style="min-width:124px; color:#000; height:24px;" class="search-value">
                                            <option value="0">全部</option>
                                            <#if fdList??>
                                                <#list fdList as item>
                                                    <#if item??>
                                                        <option value="${item.userId}"  <#if item.userId ==fmId>selected<#else></#if>>${item.realname!''}</option>
                                                    </#if>
                                                </#list>
                                            </#if>
                                        </select>
                                    </#if>


                                    <div style="width:100px;text-align:right;height:22px;line-height:22px;float:left;margin-left: 10px;">用户名：</div>
                                    <input type="text" name="searchName" id="searchName" class="search-value">

                                    <div style="width:100px;text-align:right;height:22px;line-height:22px;float:left;margin-left: 10px;">姓名 ：</div>
                                    <input type="text" name="realName" id="realName" class="search-value">

                                    <div style="width:100px;text-align:right;height:22px;line-height:22px;float:left;margin-left: 10px;">手机：</div>
                                    <input type="text" name="phone" id="phone" class="search-value">

                                    <div class="clear" style="margin-top:40px"></div>
                                    <div style="width:100px;text-align:right;height:22px;line-height:22px;float:left;margin-left: 10px;">待收开始日期：</div><input id="startDate" type="text" name="startDate" style="float:left;width:100px;padding:0 10px;height:18px;line-height:18px;" onclick="change_picktime('yyyy-MM-dd')" readonly/>
                                    <div style="width:100px;text-align:right;height:22px;line-height:22px;float:left;margin-left: 10px;">待收结束日期：</div><input id="endDate" type="text" name="endDate" style="float:left;width:132px;height:18px;line-height:18px;" onclick="change_picktime('yyyy-MM-dd')" readonly/>

                                    <div style="width:100px;text-align:right;height:22px;line-height:22px;float:left;margin-left: 10px;">申购开始日期：</div><input id="buyStartDate" type="text" name="buyStartDate" style="float:left;width:112px;padding:0 10px;height:18px;line-height:18px;" onclick="change_picktime('yyyy-MM-dd')" readonly/>
                                    <div style="width:100px;text-align:right;height:22px;line-height:22px;float:left;margin-left: 10px;">申购结束日期：</div><input id="buyEndDate" type="text" name="buyEndDate" style="float:left;width:132px;height:18px;line-height:18px;" onclick="change_picktime('yyyy-MM-dd')" readonly/>


                                    <input type="button" value="搜索"  class="input-button" style="float:left;margin-left:20px" onclick="sousuo();">
                                </div>
                            </div>


                            <!--工具栏--}-->

                            <div id="main" class="clearfix">
                                <form id="batchForm" action="#" method="post">
                                    <table class="data-list">
                                        <tr class="header">
                                            <td>ID</td>
                                            <td>用户名</td>
                                            <td>姓名</td>
                                            <td>手机</td>
                                            <td>待收剩余天数</td>
                                            <td>申购方式</td>
                                            <td>待收日期</td>
                                            <td>申购日期</td>
                                            <td>待收本息</td>
                                            <td>本金</td>
                                            <td>利息</td>
                                        </tr>
                                        <#list list as item>
                                            <#assign validTime = dateformat(item.repayTime) >
                                                <#assign nowTime = dateformat("now") >
                                                    <#assign dayLeft = ((validTime - nowTime) / (24*3600))?int >
                                                        <tr class="s">
                                                            <td>${item.id!0}</td>
                                                            <td>${item.borrowTender.user.userName!''}</td>
                                                            <td>${item.borrowTender.user.realName!''}</td>
                                                            <td>${item.borrowTender.user.phone!''}</td>

                                                            <td><#if dayLeft lte 0 >
                                                                还款日已过
                                                                <#elseif dayLeft lte 5 >
                                                                    <font color="red">${dayLeft}天</font>
                                                                    <#else>${dayLeft}天</#if>

                                                            </td>

                                                            <td>
                                                                <#if item.borrowTender.paymentType==1>
                                                                    认证支付
                                                                    <#elseif item.borrowTender.paymentType==2>
                                                                        准备金支付
                                                                        <#else>
                                                                            <#if item.borrowTender.tenderType==23||item.borrowTender.tenderType==24>
                                                                                认证支付
                                                                                <#else>
                                                                                    其他
                                                                            </#if>
                                                                </#if>
                                                            </td>

                                                            <td>${item.repayTime?string}</td>
                                                            <td>${item.addtime?string('yyyy-MM-dd')}</td>
                                                            <td>${item.repayAccount?c}</td>
                                                            <td>${item.capital?c}</td>
                                                            <td>${(item.repayAccount-item.capital)?c}</td>
                                                        </tr>
                                        </#list>
                                    </table>
                                </form>


                                <!--底部工具栏--{-->
                                <div id="bottomToolbar" class="clearfix">
                                    <div class="other-tool">
                                        <dl class="refresh-data">
                                            <dt class="refresh-data-icon"></dt>
                                            <dd><a href="javascript:void(0);" class="refresh-page">刷新数据</a></dd>
                                        </dl>
                                    </div>
                                    <!--翻页系统--{-->
                                    <div class="container s_formPage">
                                        <#import "../../common/page.html" as pager>
                                            <@pager.pagination page=page url="${pageUrl}" map=param style="style1" />
                                    </div>
                                    <!--翻页系统--}-->
                                </div>
                                <!--底部工具栏--}-->


                                <script>
                                    var url = 'queryTender.html?search=true';

                                    function sousuo(){
                                        var sou = "";
                                        var ofp = $("#searchName").val();realName
                                        var fmId = $("#fmId").val();
                                        var realName = $("#realName").val();
                                        var startDate = $("#startDate").val();
                                        var endDate = $("#endDate").val();
                                        var phone = $("#phone").val();
                                        var buyStartDate = $("#buyStartDate").val();
                                        var buyEndDate = $("#buyEndDate").val();
                                        buyEndDate
                                        if((ofp!=null&&ofp!=""&&ofp!="undefined"&&ofp!="请输入用户名关键字")){
                                            sou += "&searchName="+ofp;
                                        }
                                        if((realName!=null&&realName!=""&&realName!="undefined"&&realName!="请输入姓名关键字")){
                                            sou += "&realName="+realName;
                                        }

                                        if((phone!=null&&phone!=""&&phone!="undefined"&&phone!="请输入手机关键字")){
                                            sou += "&phone="+phone;
                                        }

                                        if(startDate!=null && startDate !=""){
                                            sou+="&startDate="+startDate;
                                        }
                                        if(endDate!=null && endDate !=""){
                                            sou+="&endDate="+endDate;
                                        }

                                        if(buyStartDate!=null && buyStartDate !=""){
                                            sou+="&buyStartDate="+buyStartDate;
                                        }
                                        if(buyEndDate!=null && buyEndDate !=""){
                                            sou+="&buyEndDate="+buyEndDate;
                                        }

                                        if((fmId!=null&&fmId!=""&&fmId!="undefined")){
                                            sou += "&fmId="+fmId;
                                        }

                                        if (sou!=""){
                                            location.href=url+sou;
                                        }
                                    }

                                    $("#searchName")[0].defaultValue=getQueryString("searchName","请输入用户名关键字");
                                    $("#phone")[0].defaultValue=getQueryString("phone","请输入手机关键字");
                                    $("#realName")[0].defaultValue=getQueryString("realName","请输入姓名关键字");
                                    function getQueryString(name,tip){
                                        var reg=new  RegExp("(^|&)"+name+"=([^&]*)(&|$)");
                                        var r =window.location.search.substr(1).match(reg);
                                        if(r!=null)
                                            return  decodeURI(r[2]);
                                        return  tip;
                                    }
                                </script>
                            </div>
        </div>
    </div>
    <div class="mc-b">
        <#include "../foot.html">
    </div>
    <#include "../jsPage.html">
    </body>
</html>